<a href='https://github.com/angular/angular.js/edit/v1.6.x/docs/content/tutorial/step_00.ngdoc?message=docs(tutorial%2F0 - Bootstrapping)%3A%20describe%20your%20change...' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this Doc</a>


<ul doc-tutorial-nav="0"></ul>


<p>In this step of the tutorial, you will become familiar with the most important source code files of
the AngularJS Phonecat App. You will also learn how to start the development servers bundled with
<a href="https://github.com/angular/angular-seed">angular-seed</a>, and run the application in the browser.</p>
<p>Before you continue, make sure you have set up your development environment and installed all
necessary dependencies, as described in the <a href="tutorial/#environment-setup">Environment Setup</a>
section.</p>
<p>In the <code>angular-phonecat</code> directory, run this command:</p>
<pre><code>git checkout -f step-0
</code></pre>
<p>This resets your workspace to step 0 of the tutorial app.</p>
<p>You must repeat this for every future step in the tutorial and change the number to the number of
the step you are on. This will cause any changes you made within your working directory to be lost.</p>
<p>If you haven&#39;t already done so, you need to install the dependencies by running:</p>
<pre><code>npm install
</code></pre>
<p>To see the app running in a browser, open a <em>separate</em> terminal/command line tab or window, then run
<code>npm start</code> to start the web server. Now, open a browser window for the app and navigate to
<a href="http://localhost:8000/index.html">http://localhost:8000/index.html</a>.</p>
<p>Note that if you already ran the master branch app prior to checking out step-0, you may see the
cached master version of the app in your browser window at this point. Just hit refresh to re-load
the page.</p>
<p>You can now see the page in your browser. It&#39;s not very exciting, but that&#39;s OK.</p>
<p>The HTML page that displays &quot;Nothing here yet!&quot; was constructed with the HTML code shown below.
The code contains some key Angular elements that we will need as we progress.</p>
<p><strong><code>app/index.html</code>:</strong></p>
<pre><code class="lang-html">&lt;!doctype html&gt;
&lt;html lang=&quot;en&quot; ng-app&gt;
  &lt;head&gt;
    &lt;meta charset=&quot;utf-8&quot;&gt;
    &lt;title&gt;My HTML File&lt;/title&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;bower_components/bootstrap/dist/css/bootstrap.css&quot; /&gt;
    &lt;script src=&quot;bower_components/angular/angular.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;

    &lt;p&gt;Nothing here {{&#39;yet&#39; + &#39;!&#39;}}&lt;/p&gt;

  &lt;/body&gt;
&lt;/html&gt;
</code></pre>
<h2 id="what-is-the-code-doing-">What is the code doing?</h2>
<p><br />
<strong><code>ng-app</code> attribute:</strong></p>
<pre><code class="lang-html">&lt;html ng-app&gt;
</code></pre>
<p>The <code>ng-app</code> attribute represents an Angular directive, named <code>ngApp</code> (Angular uses <code>kebab-case</code> for
its custom attributes and <code>camelCase</code> for the corresponding directives which implement them). This
directive is used to flag the HTML element that Angular should consider to be the root element of
our application. This gives application developers the freedom to tell Angular if the entire HTML
page or only a portion of it should be treated as the AngularJS application.</p>
<p>For more info on <code>ngApp</code>, check out the <a href="api/ng/directive/ngApp">API Reference</a>.</p>
<p><br />
<strong><code>angular.js</code> script tag:</strong></p>
<pre><code class="lang-html">&lt;script src=&quot;bower_components/angular/angular.js&quot;&gt;&lt;/script&gt;
</code></pre>
<p>This code downloads the <code>angular.js</code> script which registers a callback that will be executed by the
browser when the containing HTML page is fully downloaded. When the callback is executed, Angular
looks for the <a href="api/ng/directive/ngApp">ngApp</a> directive. If Angular finds the directive, it will bootstrap the
application with the root of the application DOM being the element on which the <code>ngApp</code> directive
was defined.</p>
<p>For more info on bootstrapping your app, checkout the <a href="guide/bootstrap">Bootstrap</a> section of the
Developer Guide.</p>
<p><br />
<strong>Double-curly binding with an expression:</strong></p>
<pre><code class="lang-html">Nothing here {{&#39;yet&#39; + &#39;!&#39;}}
</code></pre>
<p>This line demonstrates two core features of Angular&#39;s templating capabilities:</p>
<ul>
<li>A binding, denoted by double-curlies: <code>{{ }}</code></li>
<li>A simple expression used in this binding: <code>&#39;yet&#39; + &#39;!&#39;</code></li>
</ul>
<p>The binding tells Angular that it should evaluate an expression and insert the result into the DOM
in place of the binding. As we will see in the next steps, rather than a one-time insert, a binding
will result in efficient continuous updates whenever the result of the expression evaluation
changes.</p>
<p><a href="guide/expression">Angular expressions</a> are JavaScript-like code snippets that are evaluated by
Angular in the context of the current model scope, rather than within the scope of the global
context (<code>window</code>).</p>
<p>As expected, once this template is processed by Angular, the HTML page contains the text:</p>
<pre><code>Nothing here yet!
</code></pre>
<h2 id="bootstrapping-angular-applications">Bootstrapping Angular Applications</h2>
<p>Bootstrapping Angular applications automatically using the <code>ngApp</code> directive is very easy and
suitable for most cases. In advanced cases, such as when using script loaders, you can use the
<a href="guide/bootstrap#manual-initialization">imperative/manual way</a> to bootstrap the application.</p>
<p>There are 3 important things that happen during the bootstrap phase:</p>
<ol>
<li><p>The <a href="api/auto/service/$injector">injector</a> that will be used for dependency injection is created.</p>
</li>
<li><p>The injector will then create the <a href="api/ng/service/$rootScope">root scope</a> that will become the context
for the model of our application.</p>
</li>
<li><p>Angular will then &quot;compile&quot; the DOM starting at the <code>ngApp</code> root element, processing any
directives and bindings found along the way.</p>
</li>
</ol>
<p>Once an application is bootstrapped, it will then wait for incoming browser events (such as mouse
clicks, key presses or incoming HTTP responses) that might change the model. Once such an event
occurs, Angular detects if it caused any model changes and if changes are found, Angular will
reflect them in the view by updating all of the affected bindings.</p>
<p>The structure of our application is currently very simple. The template contains just one directive
and one static binding, and our model is empty. That will soon change!</p>
<p><img class="diagram" src="img/tutorial/tutorial_00.png"></p>
<h2 id="what-are-all-these-files-in-my-working-directory-">What are all these files in my working directory?</h2>
<p>Most of the files in your working directory come from the <a href="https://github.com/angular/angular-seed">angular-seed project</a>,
which is typically used to bootstrap new AngularJS projects. The seed project is pre-configured to
install the AngularJS framework (via <code>bower</code> into the <code>app/bower_components/</code> directory) and tools
for developing and testing a typical web application (via <code>npm</code>).</p>
<p>For the purposes of this tutorial, we modified the angular-seed with the following changes:</p>
<ul>
<li>Removed the example app.</li>
<li>Removed unused dependencies.</li>
<li>Added phone images to <code>app/img/phones/</code>.</li>
<li>Added phone data files (JSON) to <code>app/phones/</code>.</li>
<li>Added a dependency on <a href="http://getbootstrap.com">Bootstrap</a> in the <code>bower.json</code> file.</li>
</ul>
<h1 id="experiments">Experiments</h1>
<div></div>

<ul>
<li><p>Try adding a new expression to <code>index.html</code> that will do some math:</p>
<pre><code class="lang-html">&lt;p&gt;1 + 2 = {{1 + 2}}&lt;/p&gt;
</code></pre>
</li>
</ul>
<h1 id="summary">Summary</h1>
<p>Now let&#39;s go to <a href="tutorial/step_01">step 1</a> and add some content to the web app.</p>
<ul doc-tutorial-nav="0"></ul>





